package com.hup.sb.view;

import com.hup.utils.commons.start.BaseAppTray;
import com.hup.utils.commons.start.StartupInfo;
import com.hup.utils.swing.IconUtil;

/**
 * @author hugan
 * @date 2021/9/14
 */
public class AppTray extends BaseAppTray {

    public AppTray(MainWindow window) {
        super(IconUtil.getIcon("/img/app_tray.png", "程序图标").getImage(), StartupInfo.getApplicationChName());
        setPopupMenu(new SimpleMenu().addHeader(StartupInfo.getVersion()).addExit(), null);
        setTrayListener(new TrayActionListener() {
            @Override
            public void onClickTray() {
                window.switchVisible(true);
            }

            @Override
            public void onExit(BaseAppTray appTray) {
                System.exit(0);
            }
        });
    }

}
